package com.huluobo.a2112mvvmdouyindemo.home;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.huluobo.a2112mvvmdouyindemo.R;
import com.huluobo.a2112mvvmdouyindemo.databinding.ActivityPlayBinding;
import com.huluobo.mvvm_base.view.BaseActivity;

public class PlayActivity extends BaseActivity<ActivityPlayBinding> {
    private String path, title;

    @Override
    protected void initData() {
        dataBinding.playGsyPlayer.setUp(path, true, title);
        dataBinding.playGsyPlayer.startPlayLogic();//触发播放器播放
        //播放器返回按键点击事件
        dataBinding.playGsyPlayer.getBackButton().setOnClickListener(v -> finish());

        //播放器全屏按钮点击事件
        dataBinding.playGsyPlayer.getFullscreenButton().setOnClickListener(v -> {
            dataBinding.playGsyPlayer.setRotateViewAuto(true);//设置是否自动跟随旋转
            //设置全屏,第二个参数是是否隐藏动作条,第三个参数是是否隐藏状态栏
            dataBinding.playGsyPlayer.startWindowFullscreen(this, false, false);
        });
    }

    @Override
    protected void initView() {
        path = getIntent().getStringExtra("path");
        title = getIntent().getStringExtra("title");
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_play;
    }
}